<template>
  <div ref="tbDatalog" class="table_content">
    <el-table :max-height="tbDatalogHeight" :data="tableDataLog"
              :header-cell-style="{'font-weight':'bold', color:'#2A2A2A'}"
              border highlight-current-row style="width: 99%" >
      <el-table-column prop="module" label="工站" width="100"></el-table-column>
      <el-table-column prop="parts" label="部件" width="180"></el-table-column>
      <el-table-column prop="info" label="点检内容"></el-table-column>
      <el-table-column prop="way" label="点检方法"></el-table-column>
      <el-table-column prop="standard" label="点检标准"></el-table-column>
      <el-table-column prop="period" label="点检周期" width="80"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import qwebchannel from '../../qt5.15webchannel.js';

export default {
  data() {
    return {
      tbDatalogHeight: 500,
      tableDataLog: [{
        "id": 888,
        "station": 457111111,
        "parts": "部件",
        "content": "1",
        "way": "1", //保养方法
        "standard": "ddf",
        "period": "每日" //保养周期
      }, {
        "id": 888,
        "station": 457,
        "parts": "部件1",
        "content": "11",
        "way": "11", //保养方法
        "standard": "ddf1",
        "period": "每日1" //保养周期
      }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }, {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }
        , {
          "id": 888,
          "station": 457,
          "parts": "部件1",
          "content": "11",
          "way": "11", //保养方法
          "standard": "ddf1",
          "period": "每日1" //保养周期
        }

      ],

    }
  },
  mounted() {
    if (process.env.NODE_ENV === 'production') {
      // new qwebchannel.QWebChannel(qt.webChannelTransport, (channel) => {
        // this.qtCall = channel.objects.webBridge;
        this.qtCall = this.$qtCall
        this.qtCall.QtToJs.connect((func, json) => {
          if (func === 'RefreshPointInspectionContent') {
            var datas = JSON.parse(json)
            if (datas.code === 200) {
              console.log('获取保养内容数据', datas.data)
              this.tableDataLog = datas.data['PointInspectionContents']
            }
          }

        })
        this.qtCall.JsToQt("RefreshPointInspectionContent", {});
      // })
    }

    // this.tbDatalogHeight = this.getTbHeight()
    // console.log(' this.tbDatalogHeight',  this.tbDatalogHeight)
    this.$nextTick(() => {
      this.tbDatalogHeight = this.getTbHeight()
    })

  },
  methods: {
    getTbHeight() {
      console.log('this.$refs.tbDatalog', this.$refs.tbDatalog)
      console.log('高度---', this.$refs.tbDatalog.offsetHeight)
      var ret = this.$refs.tbDatalog.offsetHeight
      return ret
    }
  }
}
</script>

<style scoped lang="less">
.table_content {
  width: 100%;
  height: 100%;
}

.el-table .el-table__cell{
  padding: 0px;
  height: 50px;
}

/deep/ .el-table  {
    overflow-y: hidden !important;
}
</style>
